-- ==== BEGIN LICENSE BLOCK ====
-- storyboard-addon - Copyright (C) Arnaud Charnoz, 2006-2010.
-- Distributed under the terms of the GNU Lesser General Public License (LGPL) as
-- published by the Free Software Foundation.
-- ===== END LICENSE BLOCK ====

if sb == nil
then
    sb = {};
    if sb.ui == nil
    then
       sb.ui = {}; 
    end
end

sb.ui.MenuEditorController = {};
sb.ui.MenuEditorController.storyline = nil;
sb.ui.MenuEditorController.storylineDB = nil;

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:init()

    sb_ui_MenuEditorFrame_Title:SetText("SB Editor Menu");
    
    sb.ui.StorylineEditorController:init();
    
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:setStoryline( newStoryline )

    self.storyline = newStoryline;
    
    sb.ui.StorylineEditorController:setStoryline( newStoryline );
        
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:setStorylineDB( newStorylineDB )

    self.storylineDB = newStorylineDB;
        
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:Show()

    sb_ui_MenuEditorFrame:Show();
    
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:Hide()

    sb_ui_MenuEditorFrame:Hide();
    
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:IsVisible()

    return sb_ui_MenuEditorFrame:IsVisible();
    
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:onStorylineEditorButton()
     
    if sb.ui.StorylineEditorController:IsVisible() then
        sb.ui.StorylineEditorController:Hide();
    else
        sb.ui.StorylineEditorController:Show();
    end
    
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:onLocationDBEditorButton()

    if LocationDBEditorFrame:IsVisible() then
        LocationDBEditorFrame:Hide();
    else
        LocationDBEditorFrame:Show();
    end
    
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:onResetStorylineButton()

    self.storyline:reset();
    
end

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:onReloadUIButton()

    ReloadUI();
    
end 

-------------------------------------------------------------------------------

function sb.ui.MenuEditorController:onSaveButton()
    
    self.storylineDB:addStoryline( self.storyline );
    StoryBoard.db.profile.savedStoryline = self.storyline:getId();

end

-------------------------------------------------------------------------------
